/*
@Author   : Uyynot
@Email    : uyynot@qq.com
@Time     : 2023/8/16 18:09
@File     : user.go
@Project  : web_scaff
@Desc     :
*/
package models

import (
	"web_scaff/pkg/aes"

	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	Uid      int64  `json:"uid"`
	Name     string `json:"name"`
	Phone    string `json:"phone"`
	Avatar   string `json:"avatar"`
	Username string `json:"username"`
	//Pwd      string `json:"pwd"`
	Pwd string `json:"-"`
}

func (u *User) AfterFind(tx *gorm.DB) (err error) {
	if u.Phone != "" {
		u.Phone, _ = aes.AesClient.Decrypt(u.Phone)
	}
	return
}
